package com.spzx.service.Impl;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.domain.R;
import com.spzx.domain.IndexVO;
import com.spzx.product.api.RemoteCategoryService;
import com.spzx.product.api.RemoteProductService;
import com.spzx.product.api.domain.VO.CategoryVO;
import com.spzx.product.api.domain.ProductSku;
import com.spzx.service.IndexService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class IndexServiceImpl implements IndexService {
    @Resource
    RemoteCategoryService remoteCategoryService;
    @Resource
    RemoteProductService remoteProductService;

    @Override
    public IndexVO getIndexPageData() {
        R<List<CategoryVO>> firstCategoryList = remoteCategoryService.getFirstCategoryList(SecurityConstants.INNER);
        R<List<ProductSku>> productSkuIndex = remoteProductService.listHotInfo(SecurityConstants.INNER);
        IndexVO indexVO = new IndexVO();
        indexVO.setCategoryList(firstCategoryList.getData());
        indexVO.setProductSkuList(productSkuIndex.getData());
        return indexVO;
    }
}
